// mysql/AgentList.js
const Sequelize = require("sequelize");
const sequelize = require("./index"); // 确保路径正确
const { DataTypes } = Sequelize;

const AgentList = sequelize.define(
  "AgentList",
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true,
      comment: "id",
    },
    payerName: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: "付款方",
    },
    totalAmount: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: "总金额",
    },
    uuid: {
      type: DataTypes.STRING(100),
      allowNull: false,
      unique: true,
      comment: "发票号码",
    },
    infos: {
      type: DataTypes.JSON,
      allowNull: false,
      comment: "交易信息",
    },
    totalInvoiceAmount: {
      type: DataTypes.STRING(100),
      allowNull: false,
      comment: "总开票金额",
    },
    createdAt: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
      field: "created_at",
      comment: "记录创建时间",
    },
    updatedAt: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
      onUpdate: Sequelize.literal("CURRENT_TIMESTAMP"),
      field: "updated_at",
      comment: "记录更新时间",
    },
  },
  {
    tableName: "AgentList",
    timestamps: true,
  }
);

module.exports = AgentList;



// const Sequelize = require("sequelize");
// const { sequelize } = require("./index");
// const { DataTypes } = Sequelize;

// // FileUpload 模型
// const FileUpload = sequelize.define(
//   "FileUpload",
//   {
//     id: {
//       type: DataTypes.INTEGER,
//       primaryKey: true,
//       autoIncrement: true,
//       comment: "FileUploadID",
//     },
//     userId: {
//       type: DataTypes.INTEGER,
//       allowNull: false,
//       comment: "用户ID",
//     },

//     fileType: {
//       type: DataTypes.STRING(100),
//       allowNull: false,
//       comment: "filetype",
//     },
//     bisonId: {
//       type: DataTypes.STRING(100),
//       allowNull: false,
//       comment: "bison⽂件地址id",
//     },
//     originalFilename: {
//       type: DataTypes.STRING(100),
//       allowNull: false,
//       comment: "原始名称",
//     },
//     filename: {
//       type: DataTypes.STRING(100),
//       allowNull: false,
//       comment: "本地⽂件",
//     },
//     createdAt: {
//       type: DataTypes.DATE,
//       allowNull: false,
//       defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
//       field: "created_at", // 可选：指定数据库中的字段名
//       comment: "记录创建时间",
//     },
//     updatedAt: {
//       type: DataTypes.DATE,
//       allowNull: false,
//       defaultValue: Sequelize.literal("CURRENT_TIMESTAMP"),
//       onUpdate: Sequelize.literal("CURRENT_TIMESTAMP"),
//       field: "updated_at", // 可选：指定数据库中的字段名
//       comment: "记录更新时间",
//     },
//   },
//   {
//     tableName: "fileuploads",
//     timestamps: true,
//   }
// );

// module.exports = FileUpload;

